package com.hyx.spring.bean;

import com.hyx.spring.bean.Cat;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author hyx
 * @Description 测试实体类使用@Component注解将Dog类加载到IOC容器中
 * @Date 2024/3/11 10:55
 * @Version 1.0
 */
@Component
public class Dog {


    private Cat cat;

    public Cat getCat(){
        return cat;
    }

   /* public Dog(Cat cat){
        this.cat = cat;
        System.out.println("调用了有参数的构造方法。。。。");
    }*/

    public void setCat(Cat cat){
        this.cat = cat;
    }

    @Override
    public String toString() {
        return "Dog{" +
                "cat=" + cat +
                '}';
    }
}
